"""
首页页面
"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
class IndexPage(BasePage):
    url = "http://192.168.1.25/crm/index.php?m=index&a=index"

    #定位器
    xiansuo_btn_locator = (By.LINK_TEXT, '线索')  #首页页面线索
    cw_locator = (By.LINK_TEXT, '财务')  #首页页面财务
    kh_link_locator = (By.LINK_TEXT, "客户") #首页页面客户
    geren_btn_locator = (By.XPATH, '/html/body/div[1]/div/div/div[2]/ul[2]/li[6]/a') #首页页面头像
    jiarenwu_locator = (By.LINK_TEXT,'任务') #首页页面任务
    chanpin_btn_locator = (By.LINK_TEXT,'产品') #首页页面产品
    dianji_gd_locator = (By.LINK_TEXT,'更多')#首页页面更多

    #点击打开页面
    def open(self):
        self.driver.get(self.url)

    #点击线索
    def click_xiansuo_btn(self):
        self.driver.find_element(*self.xiansuo_btn_locator).click()
    #点击财务
    def click_cw_btn(self):
        self.driver.find_element(*self.cw_locator).click()
    #点击客户
    def click_kh_btn(self):
        self.driver.find_element(*self.kh_link_locator).click()
    #点击头像
    def click_geren_btn(self):
        self.driver.find_element(*self.geren_btn_locator).click()
    #点击任务
    def click_jiarenwu_btn(self):
        self.driver.find_element(*self.jiarenwu_locator).click()

    # 点击任务
    def click_chanpin_btn(self):
        self.driver.find_element(*self.chanpin_btn_locator).click()

    #点击更多
    def click_gengduo_btn(self):
        element = self.driver.find_element(*self.dianji_gd_locator).text
        return element.text